package cn.tang.tframe.common.base;

public enum ResultCode {

	SUCCESS("1001", "成功")
	, NOTLOGIN("-40001", "未登录")
//	, NOTAUTH("-20001", "没有权限")
	, OTHER("-50000", "系统错误")
	;

	private String code;
	private String desc;

	ResultCode(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public String getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}
	public static ResultCode fromCode(String code){
		ResultCode[] values = ResultCode.values();
		if(null != values){
			for(ResultCode resultCode: values){
				if(resultCode.getCode().equals(code)){
					return resultCode;
				}
			}
		}
		return null;
	}

}